package com.gandong8.trace.tool.config.rocketmq.custom;

import com.gandong8.trace.tool.consumer.rocketmq.custom.TopicOneListener;
import com.gandong8.trace.tool.config.rocketmq.RocketMqConsumerConf;
import com.gandong8.trace.tool.config.rocketmq.properties.custom.TopicOneProperties;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.client.consumer.DefaultMQPushConsumer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@EnableConfigurationProperties( TopicOneProperties.class)
@Slf4j
public class RocketMqConsumerOneConf extends RocketMqConsumerConf {

    @Autowired
    TopicOneProperties myConf;

    @Bean(name="topicOneListener", destroyMethod = "shutdown")
    public DefaultMQPushConsumer getConsumer() {
        TopicOneListener listener = new TopicOneListener();
        return super.createConsumer(myConf, listener);
    }


}
